/**
 * 
 */
package edu.hm.compiler.parser.grammar;

/**
 * @author Saruman
 */
public class ConstantString
{
    private final String string;

    /**
     * @param string
     */
    public ConstantString( final String string )
    {
        this.string = string;
    }

    public String getString()
    {
        return this.string;
    }

    @Override
    public String toString()
    {
        return "ConstantString [string=" + this.string + "]"; //$NON-NLS-1$ //$NON-NLS-2$
    }

    /*
     * (non-Javadoc)
     * @see java.lang.Object#hashCode()
     */
    @Override
    public int hashCode()
    {
        final int prime = 31;
        int result = 1;
        result = prime * result + ( ( this.string == null ) ? 0 : this.string.hashCode() );
        return result;
    }

    /*
     * (non-Javadoc)
     * @see java.lang.Object#equals(java.lang.Object)
     */
    @Override
    public boolean equals( final Object obj )
    {
        if( this == obj )
            return true;
        if( obj == null )
            return false;
        if( this.getClass() != obj.getClass() )
            return false;
        final ConstantString other = (ConstantString) obj;
        if( this.string == null )
        {
            if( other.string != null )
                return false;
        } else if( !this.string.equals( other.string ) )
            return false;
        return true;
    }

}
